Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client-set proxy headers to PDS #2251

Merged
merged 51 commits into from
Mar 7, 2024
Merged

Add client-set proxy headers to PDS #2251

merged 51 commits into from
Mar 7, 2024

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Feb 29, 2024

Add the ability to set an atproto-proxy header to a request to inform a PDS where it should forward that message to (with service auth). Currently only works for specced methods.

The syntax is atproto-proxy: ${did}#${serviceId}. For instance: atproto-proxy: did:web:api.bsky.app#bsky_appview.

When unset, the request falls back to the current PDS configuration

@dholms dholms marked this pull request as ready for review February 29, 2024 21:42
@ShreyanJain9
Copy link

Nice, so this will allow clients to easily hook into custom AppViews for non-Bluesky use-cases? 👀

@dholms
Copy link
Collaborator Author

dholms commented Mar 1, 2024

Yup yup exactly! This is actually needed for the composable mod services feature we're working on, but it will also allow a client to configuring a different appview to communicate with. Unfortunately it still only works for app.bsky methods, but soon we plan to make it work generically for any method 👌

@dholms dholms changed the base branch from main to ozone-acls-take2 March 1, 2024 04:05
ctx: AppContext,
path: string,
): { url: string; did: string } | null => {
const nsid = path.replace('/xrpc/', '')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few misc things to maybe just peek at here:

  • Do we need to check that the path starts with /xrpc too?
  • May want to handle trailing slash in the URL, I believe the pds routing permits it.
  • Express's req.url is relative to the nearest router or something like that, I forget the details but may be relevant since I know it gets passed here. There is also req.originalUrl which might be more reliable for us.

dholms and others added 10 commits March 4, 2024 16:05
add runit to the services/bsky Dockerfile
* Allow tags to lead with and contain only numbers

* Break tags on other whitespace characters

* Export regexes from rich text detection

* Add test

* Add test

* Disallow number-only tags

* Avoid combining enclosing screen chars

* Allow full-width number sign

* Clarify tests

* Fix punctuation edge case

* Reorder

* Simplify, add another test

* Another test, comment
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Base automatically changed from ozone-acls-take2 to main March 6, 2024 01:04
@dholms dholms merged commit 2267f1e into main Mar 7, 2024
6 of 13 checks passed
@dholms dholms deleted the pds-proxy-headers branch March 7, 2024 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants